<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Z-7
  Date: 2022/3/5
  Time: 11:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="${pageContext.request.contextPath}/resource/bootstrap4/css/bootstrap.css" rel="stylesheet">
    <script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/jquery-3.2.1.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/resource/bootstrap-treeview/js/bootstrap-treeview.js"></script>
    <script src="${pageContext.request.contextPath}/resource/bootstrap4/js/bootstrap.js"></script>
    <title>基金详情</title>
</head>
<body>
<blockquote class="blockquote text-center">
    <p class="mb-0">支付宝基金</p>
    <footer class="blockquote-footer">基金<cite title="Source Title">详情</cite></footer>
</blockquote>
<jsp:include page="../head.jsp"/>
<div class="container">
    <span>名称：${funds.name}</span>
    <span>基金经理：${funds.manager}</span>
    <span>类型：${funds.typeName}</span>
    <span>当前价格：${funds.price}</span>
    <table class="table">
        <thead>
        <tr>
            <th scope="col">月份</th>
            <th scope="col">价格</th>
            <th scope="col">销售额</th>
            <th scope="col">操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${funds.details}" var="detail">
            <tr>
                <th scope="row">${detail.month}</th>
                <td>${detail.price}</td>
                <td>${detail.num * detail.price}</td>
                <td>
                    <button type="button" class="btn btn-info" onclick="to_add(${funds.id})">购买</button>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>
<script type="text/javascript">
    function to_add(id) {
        location="${pageContext.request.contextPath}/funds/to_add?id="+id;
    }
    function to_detail(id) {
        location="${pageContext.request.contextPath}/funds/detail?id="+id;
    }
</script>
</body>
</html>
